<script>
  var configureList = [];
  var readyList = [];
  
  function clearTestLists() {
    configureList = [];
    readyList = [];
  }

  var readyBehavior = {
    moniker: function() {
      return this.is + (this.id ? '#' + this.id : '')
    },
    // use private, stateful, method for testing purposes
    _configure: function() {
      chai.assert.isTrue(!this.isAttached, 'Element should not be attached when configured.');
      configureList.push(this.moniker());
    },
    ready: function() {
      readyList.push(this.moniker());
    },

    attached: function() {
      chai.assert.isTrue(this._readied, 'Element not ready when attached');
    }
  };
</script>

<template>
  x-zot<content></content>
</template>
<script>
  Polymer({
    is: 'x-zot',
    behaviors: [readyBehavior]
  });
</script>

<template>
  <x-zot></x-zot>
</template>
<script>
  Polymer({
    is: 'x-bar',
    behaviors: [readyBehavior]
  });
</script>

<template>
  <x-bar id="bar1"></x-bar>
  <x-bar id="bar2"></x-bar>
</template>
<script>
  Polymer({
    is: 'x-foo',
    behaviors: [readyBehavior]
  });
</script>

<template>
  <x-zot id="a">
    <x-zot id="b"></x-zot>
    <x-zot id="c">
      <x-zot id="d"></x-zot>
    </x-zot>
  </x-zot>
  <x-foo id="foo"></x-foo>
</template>
<script>
  Polymer({
    is: 'x-ready',
    behaviors: [readyBehavior]
  });
</script>